//
//  UIImage+DHImage.m
//  宏达APP
//
//  Created by DIANGHONG on 2018/4/28.
//  Copyright © 2018年 123. All rights reserved.
//

#import "UIImage+DHImage.h"

@implementation UIImage (DHImage)

- (UIImage *)scaleToSizeWithSize:(CGSize)newSize{
    
    //开启图片上下文
    UIGraphicsBeginImageContext(newSize);
    
    [self drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
    
    UIImage *scaleImg = UIGraphicsGetImageFromCurrentImageContext();
    
    //关闭图片上下文
    UIGraphicsEndImageContext();
    
    return scaleImg;
}

@end
